<template>
  <div class="about">
    <h1 name="aa">测试组件</h1>
    <div>测试props</div>
    <p>父元素的data:{{nowTime}}</p>
    <button @click="changeTest">改变父元素的</button>
    <p></p>
    <button @click="doEmit">doEmit</button>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";
import { useRouter } from "vue-router";
import { useStore } from "vuex";

export default defineComponent({
  props: ["nowTime", "changeTest"],
  setup(props, context) {
    const router = useRouter();
    const store = useStore();
    store.commit("getA");
    store.dispatch("getB");
    const doEmit = (): void => {
      context.emit("myclick", "ceshi emit");
      router.push("/");
    };
    return {
      doEmit,
    };
  },
});
</script>

<style lang="less">
</style>
